Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

108
Visualizações
Hotelbeds limiting results to filter->zone

I'm trying to setup the hotelbeds API. Now I'm gettings the results I expect up till the point where I'm trying to apply a filter:

    $rqData->destination = new Destination("PAR");

    $occupancy = new Occupancy();
    $occupancy->adults = 2;
    $occupancy->children = 1;
    $occupancy->rooms = 1;

    $occupancy->paxes = [   new Pax(Pax::AD, 30, "Mike", "Doe"), 
                            new Pax(Pax::AD, 27, "Jane", "Doe"), 
                            new Pax(Pax::CH, 8, "Mack", "Doe") 
                        ];
    $rqData->occupancies = [ $occupancy ];

    $filter = new Filter();
    $filter->zone = 64 ;
    $rqData->filter = [ $filter ];

    $availRS = $apiClient->availability($rqData);

    if ($availRS->isEmpty()) {
       echo "There are no results!";
    }

    $allResponse = $availRS->hotels->toArray();

As you can see I set the filter to zone 64 which gives me the following error:

Fatal error: Uncaught exception 'Exception' with message 'Type error: Field filter needs hotelbeds\hotel_api_sdk\model\Filter type!' in C:\xampp2\htdocs\hotelbeds\src\generic\DataContainer.php:58 Stack trace: #0 C:\xampp2\htdocs\hotelbeds\test.php(110): hotelbeds\hotel_api_sdk\generic\DataContainer->__set('filter', Array) #1 {main} thrown in C:\xampp2\htdocs\hotelbeds\src\generic\DataContainer.php on line 58

I did add the zone to the filterclass as an integer. I got this filter from the testfunction http://testapi.hotelbeds.com/search -> request

{
  "stay": {
    "checkIn": "2017-05-08",
    "checkOut": "2017-05-12",
    "shiftDays": 2
  },
  "occupancies": [
    {
      "rooms": 1,
      "adults": "2",
      "children": "0",
      "paxes": [
        {
          "type": "AD",
          "age": "30"
        },
        {
          "type": "AD",
          "age": "30"
        }
      ]
    }
  ],
  "filter": {
    "maxHotels": 20,
    "maxRooms": 4,
    "maxRatesPerRoom": 3,
    "minCategory": 1,
    "maxCategory": 5,
    "paymentType": "BOTH",
    "maxRate": "3000"
  },
  "destination": {
    "code": "PAR",
    "zone": "64"
  }
}

Would be great if anybody could tell me what I'm doing wrong.

Thanks in advance!

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda